package com.czl.websocket.util;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 石雷
 * shilei1@jiayuan.com
 * 2021/1/20/020 16:17
 */
public class UrlUtil {

    /**
     * 将url参数转换成map
     * @param param aa=11&bb=22&cc=33
     * @return
     */
    public static Map<String, Object> getUrlParams(String param) {
        Map<String, Object> map = new HashMap<String, Object>(0);
        if (param==null||param.length()==0) {
            return map;
        }
        String[] params = param.split("&");
        for (int i = 0; i < params.length; i++) {
            String[] p = params[i].split("=");
            if (p.length == 2) {
                map.put(p[0], p[1]);
            }
        }
        return map;
    }


}
